Version

AddChange(String,String,Func<UndoExecuteContext,Boolean>,Func<UndoExecuteContext,Boolean>,Object) Method

Adds an UndoUnit to the history.
Syntax
'Declaration
 
Public Overloads Function AddChange( _
   ByVal description As String, _
   ByVal detailedDescription As String, _
   ByVal undoMethod As Func(Of UndoExecuteContext,Boolean), _
   ByVal redoMethod As Func(Of UndoExecuteContext,Boolean), _
   Optional ByVal target As Object _
) As UndoUnit

Parameters

description
The general description for the transaction.
detailedDescription
The detailed description for the transaction.
undoMethod
The method to invoke when an Undo is being performed
redoMethod
The method to invoke when an Redo is being performed
target
An optional parameter that represents the object that will be affected by the operation.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionThe 'undoMethod' and 'redoMethod' parameters cannot be null.
Remarks

This overload creates an undo unit that will execute the undoMethod when an Undo operation is being performed and will execute the redoMethod when a Redo operation is being performed. If the operation is successful (i.e. the method returns true) the UndoUnit will add itself back into the history.

Note: Since an explicit description is passed in, the string should be applicable to both undo and redo operations. For example one might use "Bold" or "Toggle Bold" instead of "Enable Bold"/"Disable Bold" since the latter might not be correct if the change is being created for the redo stack. If you do want to use a string specific to the context then you might decide which description to provide by evaluating the IsPerformingRedo property.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also